package doit20.datayi.utils;

import org.lionsoul.ip2region.DataBlock;
import org.lionsoul.ip2region.DbConfig;
import org.lionsoul.ip2region.DbMakerConfigException;
import org.lionsoul.ip2region.DbSearcher;

public class Ip2RegionTest {
    public static void main(String[] args) throws Exception {

        DbConfig dbConfig = new DbConfig();
        DbSearcher dbSearcher = new DbSearcher(dbConfig, "data/ip2region/ip2region.db");
        DataBlock dataBlock = dbSearcher.memorySearch("222.64.158.53");

        System.out.println(dataBlock.getCityId());

        // 中国|0|江苏省|南京市|0
        System.out.println(dataBlock.getRegion());
        String[] split = dataBlock.getRegion().split("\\|");
        System.out.println(split[2]);






        System.out.println(dataBlock.getDataPtr());



    }
}
